﻿using System;
using Hopscotch.Domain.Common.StateTracking;

namespace Hopscotch.Presentation.Common
{
    public enum ToolEditMode
    {
        None = 0,
        New = 1,
        Update = 2,
        Delete = 3
    }

    public static class ToolEditModeHelper
    {
        public static ToolEditMode Map(ObjectChangeTracker changeTracker)
        {
            if (changeTracker.State == ObjectState.Added)
            {
                return ToolEditMode.New;
            }
            else if (changeTracker.State == ObjectState.Modified)
            {
                return ToolEditMode.Update;
            }
            else if (changeTracker.State == ObjectState.Deleted)
            {
                return ToolEditMode.Delete;
            }

            return ToolEditMode.None;
        }

    }
}
